# ---------------------------------------------------------------------------
# Author: jachymko
# Desc:   Initializes profile environment.
# Date:   Dec 23, 2006
# Site:   http://www.codeplex.com/PowerShellCX
# Usage:  In your profile place the following command:
#  
#         . "$Env:PscxHome\Profile\Environment.ps1"
# ---------------------------------------------------------------------------

# ---------------------------------------------------------------------------
# Product versions
# ---------------------------------------------------------------------------
Set-Variable PscxVersion ((Get-FileVersion (Get-PSSnapin Pscx).ModuleName).ProductVersion) -Scope global -Option ReadOnly -Description "PSCX variable"

# ---------------------------------------------------------------------------
# Misc useful objects
# ---------------------------------------------------------------------------
Set-Variable Shell (new-object -com Shell.Application) -Scope global -Option ReadOnly -Description "PSCX variable"

# ---------------------------------------------------------------------------
# Directory variables
# ---------------------------------------------------------------------------
Set-Variable Docs    ([Environment]::GetFolderPath('MyDocuments')) -Scope global -Option ReadOnly -Description "PSCX variable"
Set-Variable Desktop ([Environment]::GetFolderPath('DesktopDirectory')) -Scope global -Option ReadOnly -Description "PSCX variable"

# ---------------------------------------------------------------------------
# Identity, access control and ownership
# ---------------------------------------------------------------------------
Set-Variable NTIdentity ([Security.Principal.WindowsIdentity]::GetCurrent()) -Scope global -Option ReadOnly -Description "PSCX variable"
Set-Variable NTAccount ($NTIdentity.User.Translate([Security.Principal.NTAccount])) -Scope global -Option ReadOnly -Description "PSCX variable"
Set-Variable NTPrincipal (new-object Security.Principal.WindowsPrincipal $NTIdentity) -Scope global -Option ReadOnly -Description "PSCX variable"
Set-Variable IsAdmin ($NTPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) -Scope global -Option ReadOnly -Description "PSCX variable"

